import { getApisData } from '@/services/cpasRequest';
import { getAccountInfo } from '../product/YearAnalysis/server';
export async function updateBB_BasType(dbname: string, paramsData: any[], table: string) {
  const postData = {
    apis: [
      {
        name: 'sqlApi.update',
        params: { name: `[${dbname}]..${table}`, rows: paramsData },
      },
    ],
    reload: true,
    params: {},
  };
  const resApis = await getApisData(postData);
  const resUpdate = resApis.data['sqlApi.update'];
  if (resApis.ok && resUpdate.ok) {
    return Promise.resolve({
      data: 'BAS_Product, 更改信息成功！',
      success: true,
    });
  }
  return Promise.resolve({
    data: resApis.data,
    success: false,
  });
}

export async function updateComputerData(dataId: number, dbname: string) {
  try {
    let dd = await getAccountInfo('Analysis.Inventory.JJJS', {
      dbname: dbname,
      dataId: `${dataId}`,
    });
    return dd;
  } catch (error) {
    console.log(error);
  }
}
